package com.tjetc.controller;

import com.tjetc.entity.po.Coupon;
import com.tjetc.service.ICouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author gaoyongxiang
 * @version v1.0
 * @since 2025-10-27
 */
@RestController
@RequestMapping("/coupon/")
public class CouponController {

    @Autowired
    private ICouponService couponService;


    // 发放优惠券
    @PostMapping("seckill")
    public String addSeckillCoupon(@RequestBody Coupon coupon){
        return couponService.addSeckillCoupon(coupon);
    }


    // 秒杀优惠券
    @PostMapping("seckill/{id}")
    public String seckillCoupon(@PathVariable("id") Integer id) {
        return couponService.seckillCoupon(id);
    }
}
